﻿using UnityEngine;
using System.Collections;

public class Jogador : MonoBehaviour {

	private Vector3 screenPoint;
	public Texture bTexture;
	public GUIStyle meuStyle;

	// Use this for initialization
	void Start ()
	{
		
	}
	
	// Update is called once per frame
	void Update ()
	{
		
	}

	void OnGUI()
	{
		// Fecha o Jogo
		if (GUI.Button(new Rect(10,10,70,50), bTexture, meuStyle))
		{
			Application.Quit();
		}
	}

	void OnMouseDown()
	{
		screenPoint = Camera.main.WorldToScreenPoint (gameObject.transform.position);
	}
	
	void OnMouseDrag()
	{
		Vector3 currentScreenPoint = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
		Vector3 currentPos = Camera.main.ScreenToWorldPoint (currentScreenPoint);
		transform.position = currentPos;
	}
}
